﻿namespace SXICE.WebAPI.Models
{
    /// <summary>
    /// JWT配置
    /// </summary>
    public class JwtSettings
    {
        /// <summary>
        /// Token颁发者
        /// </summary>
        public string Issuer { get; set; }

        /// <summary>
        /// 可使用的客户端
        /// </summary>
        public string Audience { get; set; }

        /// <summary>
        /// 加密的Key
        /// </summary>
        public string SecretKey { get; set; }

        /// <summary>
        /// 过期时间（分钟）
        /// </summary>
        public int LifeTime { set; get; }

        /// <summary>
        /// 验证方式
        /// </summary>
        public AuthorizationTypeEnum AuthorizationType { set; get; }

        /// <summary>
        /// 自动颁发新Token的头Key（为空则不自动颁发）
        /// </summary>
        public string AutoReIssueTokenHeader { set; get; }
    }

    /// <summary>
    /// 验证方式
    /// </summary>
    public enum AuthorizationTypeEnum
    {
        /// <summary>
        /// Cookie
        /// </summary>
        Cookie,
        /// <summary>
        /// Token
        /// </summary>
        Token
    }
}
